<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>中断promise链条</title>
</head>
<body>
<script>
    let p = new Promise((resolve, reject) => {
        setTimeout(() => {
            resolve('ok')
        }, 1000)
    })

    p.then(value => {
        console.log(111)
        // throw new Error('想要中断promise链条')
        return new Promise((resolve, reject) => {
        })
    }).then(value => {
        console.log(222)
    }).then(value => {
        console.log(333)
    }).catch(reason => {
        console.log(reason)
    })
    /**
     *中断promise链条是指 直接断掉改promise链,不能去执行catch里面的代码
     *如果使用throw抛出异常,会被catch捕获到
     *
     * 想要中断promise链条唯一的方法就是return一个promise
     */
</script>
</body>
</html>